package com.xyhuo.leetcode.y2025;

import java.util.Arrays;

public class IsAnagram {

    public boolean isAnagram(String s, String t) {
        if (s.length() != t.length()) {
            return false;
        }
        char[] sC = s.toCharArray();
        char[] tC = t.toCharArray();
        Arrays.sort(sC);
        Arrays.sort(tC);
        for (int i = 0; i < sC.length; i++) {
            if (sC[i] != tC[i]) {
                return false;
            }
        }
        return true;
    }
}
